<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SMS Gateway JTK</title>
<style type="text/css">
		@import "<?php echo base_url();?>css/templatemo_style.css";
</style>
<!-- <link href="templatemo_style.css" rel="stylesheet" type="text/css" /> -->
</head>
<body>
<div id="templatemo_header_wrapper">
    <div id="templatemo_header">
    	<div id="site_title">            
        </div>    
    </div> <!-- end of templatemo_header -->
</div> <!-- end of templatemo_menu_wrapper -->

<div id="templatemo_menu_wrapper">
    <div id="templatemo_menu">
        
        <ul>
            <li><a href="<?php echo base_url();?>home">Home</a></li>
            <li><a href="<?php echo base_url();?>master_data" class="current">Master Data</a></li>
            <li><a href="<?php echo base_url();?>sms_gateway">SMS Gateway</a></li>
            <li><a href="<?php echo base_url();?>settings">Settings</a></li>
			<li><a href="<?php echo base_url();?>home/logout">Logout</a></li>
			<!--
            <li><a href="#">Members</a></li>
            <li><a href="#">Contact</a></li>			
			-->
        </ul>    	
    
    </div> <!-- end of templatemo_menu -->
</div>

<div id="templatemo_content_wrapper">

	
	<div id="templatemo_sidebar">
		
    	<div class="sidebar_box">
        	
            
			
			<div class="news_box"> </div>
			
            <?php include "sidebar_master_data.php"; ?>            
        
        </div>
		<div class="sidebar_box_bottom"></div>
        
			      
		
		
    
    </div> <!-- end of sidebar -->
    
    <div id="templatemo_content">
    
    	<div class="content_box">
			<?php
			$id1 = $this->uri->segment(3);
			$id = $this->uri->segment(2);
			//echo "uri : " . $id . '<br>';
			if($id=="edit"){
			?>
				<?php foreach ($data as $row) { ?>
					<?php echo form_open('mahasiswa/update'); ?>
					<h1>Edit Data</h1>
				<table border="0">
				<tr>
					<td>nim</td>
					<td><input type="text" name="nim" value="<?php echo $row->nim; ?>" readonly></td>	
				</tr>
				<tr>
					<td>Nama</td>
					<td><input type="text" name="nama" value="<?php echo $row->nama; ?>"></td>	
				</tr>
				<tr>
					<td>Hp</td>
					<td><input type="text" name="hp" value="<?php echo $row->hp; ?>"></td>	
				</tr>				
				<tr>
					<td></td>
					<td><input type="submit" value="Update" ></td>	
				</tr>
					<?php } ?>
				</table>
					<?php form_close(); ?>			
			<?php
			}else{
				echo form_open('mahasiswa/tambah'); 			
				echo "
				<h2>Tambah Data Mahasiswa</h2>
				<table>
				<tr>
				<td>nim </td><td> : </td><td><input type='text' name='nim' placeholder='nim' required autofocus></td>
				</tr>
				<tr>
				<td>Nama </td><td> : </td><td><input type='text' name='nama' placeholder='nama' required></td>
				</tr>
				<tr>
				<td>Hp </td><td> : </td><td><input type='text' name='hp' placeholder='hp' required></td>
				</tr>			
				<tr>
				<td></td><td> </td><td><input type='submit' value='Simpan'></td>
				</tr>				
				<table>";			
				form_close(); 
				?>
				<table border="1">
				<tr>
					<td>Nim</td>
					<td>Nama</td>
					<td>Hp</td>
					<td colspan="2">Aksi</td>
				</tr>
					<?php foreach ($data as $row) { ?>
					<tr>
					
						<td><?php echo $row->nim; ?> </td>
						<td><?php echo $row->nama; ?> </td>
						<td><?php echo $row->hp; ?> </td>						
						<td><a href= '<?php echo base_url(); ?>mahasiswa/edit/<?php echo $row->nim; ?>' >Edit</a>						
						</td>
						<td><a href= '<?php echo base_url(); ?>mahasiswa/hapus/<?php echo $row->nim; ?>'>Hapus</a></td>
					</tr>
					<?php } ?>
				</table>
				<?php
			}			
			?>
          
        </div>
		<div class="content_box_bottom"></div>
        
		
    
    </div> <!-- end of content -->
    
    <div class="cleaner"></div>

</div>

<div id="templatemo_footer_wrapper">

    <div id="templatemo_footer">
    
        <ul class="footer_menu">
                    
                </ul>
                
                
    </div>
    
</div>
</body>
</html>